/**
 * @author hoang.pt
 * @version $Id: Drawing.java 124 2010-08-31 08:12:28Z phantichhoang $
 */

package snippet.lab2;

/**
 * Drawing
 * @author hoang.pt
 */
public class Drawing implements Runnable{

	/**
	 * @var String
	 */
    String name;

    /**
     * @var integer
     */
    int deposit;

    /**
     * @var Account
     */
    Account acc;

    /**
     * @var universal var
     */
    Thread t;

    /**
     * 
     * @param String name
     * @param int deposit
     * @param Account acc
     */
    public Drawing(String name, int deposit, Account acc) {
        this.name = name;
        this.deposit = deposit;
        this.acc = acc;

        this.t = new Thread(this);
        t.start();
    }
    
    /**
     * Override method
     * @author hoang.pt
     */
    public void run() {
        //draw money
        try {
			acc.drawMoney(name, deposit);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}

        System.out.print("\n");
        System.out.println("Now balance is " + acc.balance);


    }


    
}
